package com.ext.aic.builder;

public class ParamsBuilder {
    private StringBuilder params = new StringBuilder();

    public ParamsBuilder add(String key, String value) {
        if (params.length() > 0) {
            params.append("&");
        }
        params.append(key).append("=").append(value);
        return this;
    }

    public ParamsBuilder add(String key, int value) {
        if (params.length() > 0) {
            params.append("&");
        }
        params.append(key).append("=").append(value);
        return this;
    }

    public ParamsBuilder add(String key, boolean value) {
        if (params.length() > 0) {
            params.append("&");
        }
        params.append(key).append("=").append(value);
        return this;
    }

    public ParamsBuilder add(String key, long value) {
        if (params.length() > 0) {
            params.append("&");
        }
        params.append(key).append("=").append(value);
        return this;
    }

    public ParamsBuilder add(String key, double value) {
        if (params.length() > 0) {
            params.append("&");
        }
        params.append(key).append("=").append(value);
        return this;
    }

    public ParamsBuilder add(String key, float value) {
        if (params.length() > 0) {
            params.append("&");
        }
        params.append(key).append("=").append(value);
        return this;
    }

    public String build() {
        return params.toString();
    }
}
